<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 90px;
            float: left;
            padding: 5px;
            margin: 5px;
            background-color: #EEEEEE;
        }
    </style>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>

<body>
    <div class="js">
        <p>class="div1"</p>
        <p>选中</p>
    </div>
    <div class="js">
        <p>class="div2"</p>
        <p>选中</p>
    </div>

    <div class="jq">
        <p>class="div3"</p>
        <p>jQuery选中</p>
    </div>

    <div class="jq">
        <p>class="div3"</p>
        <p>jQuery选中</p>
    </div>
    <!-- js原生实现 -->
    <script>
        var divs = document.getElementsByClassName('js');
        for (var i = 0; i < divs.length; i++) {
            divs[i].style.border = "3px solid blue";
        }
    </script>
    <!-- jquery实现 -->
    <script>

        $('.jq').css("border", "3px solid red");
    </script>
</body>

</html>